<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="../common/tag.jsp" %>
<c:set var="_underCustomPush" value="active" scope="request"/>
<c:set var="_pageTitle" value="自定义消息推送" scope="request"/>
<!DOCTYPE html>
<html>
<head>
	<title>${_pageTitle}</title>
	<%@include file="../common/head.jsp" %>
</head>
<body>
<%@include file="../common/topbar.jsp" %>
<div class="ch-container">
	<div class="row">
		<%@include file="../common/left.jsp" %>
		<!-- main content -->
		<div class="page-header"><h3>${_pageTitle}</h3></div>
		<form id="search_form" action="${basePath}/jpush/customPushInfo"
			  method="post" class="form-inline">
			<table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
				<tr>
					<th style="vertical-align: top; padding-right: 10px;">推送内容</th>
					<td>
						<div style="margin-bottom: 10px">
							<input id="add" type="button" class="btn btn-default" value="添加" />
						</div>
						<div id="infoList">
							<div style="float: left; margin-right: 20px; margin-bottom: 10px" class="log-item">
							<textarea style="width: 200px; height: 100px; margin-bottom: 10px" class="form-control"
									  name="info"></textarea>
								<div>
								<span style="float: left"> 语言：<select name="languageId" class="form-control selectWidth">
										<option value="1">中文</option>
										<option value="2">英文</option>
								</select>
								</span> <span style="float: right">
									<button type="button" class="delete-log btn btn-danger">删除</button>
								</span>
								</div>
							</div>
						</div>
					</td>
				</tr>
				<tr style="border-top: 1px solid #ccc;">
					<td></td>
					<td><input id="upload" type="submit" value="发送" class="btn btn-primary"/></td>
				</tr>
			</table>
		</form>
		<!-- end main content -->
		<!-- content ends -->

		<c:import url="../common/footer.jsp"/>
			<script type="text/javascript">
                $(document).ready(function(){
                    $("#upload").click(function(){
                        $(this).attr("disabled","true");
                        $("#form").submit();
                    });
                    $("#add").click(function() {
                        var divdom='<div  style="float: left;margin-right: 20px;margin-bottom: 10px" class="log-item">'+
                            '        <textarea style="width: 200px; height: 100px;margin-bottom: 10px"'+
                            '                  name="info"></textarea>'+
                            '                        <div>'+
                            '                           <span style="float: left">'+
                            '                                语言：<select'+
                            '                                   name="languageId" class="form-control selectWidth">'+
                            '                            <option value="1">中文</option>'+
                            '                            <option value="2">英文</option>'+
                            '                        </select>'+
                            '                           </span>'+
                            '                            <span style="float: right">'+
                            '                                 <button type="button" class="delete-log btn btn-danger">删除</button>'+
                            '                            </span>'+
                            '                        </div>'+
                            '                    </div>';
                        $("#infoList").append(divdom);
                    });
                    $("#infoList").on('click','.delete-log',function(){
                        $(this).parent().parent().parent('div.log-item').remove();
                    });
                });
			</script>